<script setup>
    import { reactive, computed } from 'vue';
    import { useStore } from 'vuex';
    import TreeMenu from './treeMenu.vue';
    //获取router实例
    import { useRouter } from 'vue-router';

    const router = useRouter();
    // const menuData = reactive(router.options.routes[0].children)
    const menuData = computed(() => store.state.menu.routerList)
    const store = useStore();
    //获取store.state.模块.变量名
    const isCollapse = computed(() => store.state.menu.isCollapse)
    const handleOpen = () => { }
    const handleClose = () => { }
    const active = computed(() => store.state.menu.menuActive)
</script>

<template>
    <el-menu :style="{ width: !isCollapse ? '230px' : '64px' }" active-text-color="#ffd04b" background-color="#545c64"
        text-color="#fff" class="aside-container" @open="handleOpen" @close="handleClose"
        :collapse="isCollapse" :default-active="active">

        <p class="logo-lg">{{ isCollapse ? 'DIDI' : 'DIDI陪诊' }}</p>

        <TreeMenu :index="1" :menuData="menuData"></TreeMenu>
    </el-menu>
</template>

<style lang="less" scoped>
    .aside-container {
        height: 100%;
    }

    .logo-lg {
        font-size: 20px;
        text-align: center;
        height: 50px;
        line-height: 50px;
        color: #fff;
    }
</style>